package com.baizhi.service.impl;

import com.baizhi.annotation.AddCacheAnnotation;
import com.baizhi.dao.RoleDao;
import com.baizhi.entity.Role;
import com.baizhi.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleDao roleDao;


    @Override
    @AddCacheAnnotation
    public Map selectAllRole(int page, int limit) {
        int offset=(page-1)*limit;
        List<Role> list=roleDao.selectAllRole(offset,limit);
        int count = roleDao.selectCountRole();
        Map map=new HashMap();
        map.put("data",list);
        map.put("count",count);
        map.put("code",0);
        map.put("msg","");
        return map;
    }
}
